﻿<script type="text/javascript" language="javascript">
var g_cash = parseInt("$GuessCash$");
		$(function(){
			$("#addexp").click(function(){
				if($(this).text()=="添加竞猜详细说明"){
					$(this).text("隐藏竞猜详细说明");
					this.className = "dotup";
					$("#txtexp").fadeIn();
					$("#txtexp").find("input[type=hidden]").val(1);
				}
				else{
					$(this).text("添加竞猜详细说明");
					this.className = "dotdown";
					$("#txtexp").fadeOut();
					$("#txtexp").find("input[type=hidden]").val(0);//当值为0的时候不取详细说明数据。
				}
			}), 
			inputDisable(),
			$("#additem").click(function(){
				$("#itemlist").removeClass("hid");
				$(this).hide();
			});
			$(".userinfo input[type=text]").keyup(function(){
				funradio(this);
			}),
			$(".userinfo input[type=text]").keydown(function(){
				funradio(this);
			})
		})
		var inputDisable = function(){
			$(".userinfo input[type=radio]").attr("disabled","disabled");
		}
		var funradio = function(text){
			if(text.value.length!=0){
				$(text).next().attr("disabled","")
			}
			else{
				$(text).next().attr("disabled","disabled");
				$(text).next().attr("checked","");
			}
		}
		function check(){
    if($("#txtTitle").val()=="")
    {
        alert("忘了填写竞猜题目了吧");
        return false;
    }
     if($("#txtTitle").val().length <8)
    {
        alert("竞猜题目太简短了吧");
        return false;
    }
    var count = 0;
    var items= $(".userinfo input[type=text]");
    for(i=1;i<items.length;i++){
        if($(items[i]).val()!="")
            count++;
    }
    if(count<2)
    {
        alert("至少要两个以上的结果吧");
        return false;
    }
    var item = $("input[type=radio]:checked").val();
    if(item ==null)
    {
        alert("请选择一个正确项，点选结果后的单选按钮");
        return false;
    }

    return true; 
    
}
function resetMaxshare()
{
  
	var point = parseInt($("#point option:selected").val());
	var multiple = parseInt($("#multiple option:selected").val());	
	
	var maxshare = Math.floor(g_cash/(point*multiple));
	var options = $("#maxshare");
	var length = options.length - 1;    
	for(var i = length; i >= 0; i--)
	{    
	    $("#maxshare").html("");
	}
	if(maxshare == 0)
	{
		$("#maxshare").html("");
		alert(" 根据你的此竞猜题设置，至少需要预扣积分"+(joincost*odds)+"分\n 你的积分不够！");
		return false;
	}
	
	if(maxshare > 3000)
	{
		maxshare = 3000;
	}
	
	var j = 0;
	var step = 1;
	var str="";
	for(i=step ; i<=maxshare ; )
	{ 
        str = str +"<option value='"+i+"'>"+i+"</option>";
                if(i < 10)
                {
                	step = 1;
                }
                else if(i < 100)
                {
                	step = 10;
                }
                else if(i < 1000)
                {
                	step = 50;
                }
                else if(i < 10000)
                {
                	step = 100;
                }
		i = i+step;
		j++;
	}

	$(str).appendTo("#maxshare")//添加下拉框的option    

}
    </script>